package com.power.sifa.approve.dao;

import com.power.sifa.approve.model.Apl_typical_case;
import com.power.sifa.approve.model.pojo.vo.TypicalCaseVO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;

import javax.transaction.Transactional;
import java.io.Serializable;
import java.util.List;

/**
 * 典型案件收藏表 持久层(hibernate)
 */

public interface Apl_typical_caseDao extends JpaRepository<Apl_typical_case, Serializable>, JpaSpecificationExecutor<Apl_typical_case>, Repository<Apl_typical_case, Serializable>, Apl_typical_caseDaoCustom<Apl_typical_case, Serializable> {

   @Modifying
   @Transactional
   @Query("delete  from Apl_typical_case s where  s.id in (:ids) ")
   void removeByIds(@Param("ids") List<Integer> ids);

   @Query(" from Apl_typical_case s where  s.applyname = :applyname and s.classify = :classify ")
   List<Apl_typical_case> queryTypicalByApplyName(@Param("applyname") String applyname,
                                                  @Param("classify") String classify);

   @Query(" from Apl_typical_case s where  s.targetname = :targetname and s.classify = :classify ")
   List<Apl_typical_case> queryTypicalByTargetName(@Param("targetname") String targetname,
                                                   @Param("classify") String classify);

   @Query(" from Apl_typical_case s where s.classify = :classify ")
   List<Apl_typical_case> queryTypicalByClassify(@Param("classify") String classify);

}
